package com.yijumao.shop.domain;

import java.io.Serializable;

/**
 * @author konley
 * @date 2020-11-15 14:37
 * 购物项
 */
public class CartItem implements Serializable {
    private Item item; //商品
    private Integer count; //数量
    private double subtotal; //小计

    public CartItem() {
    }

    //构造方法
    public CartItem(Item item, Integer count) {
        this.item = item;
        this.count = count;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Double getSubtotal() {
        //计算商品小计
        subtotal = count * item.getShopPrice();
        return subtotal;
    }

    public void setSubtotal(Double subtotal) {
        this.subtotal = subtotal;
    }
}
